home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Sunday Times: The Month 2004 October
/
The Sunday Times - The Month 2004-10.iso
/
pc
/
assets
/
bespoke
/
feature
/
movies
/
section6.swf
/
scripts
/
frame_1
/
DoAction.as
Wrap
Text File
|
2004-09-05
|
21KB
|
713 lines
function monitorLoad(what)
{
var _loc1_ = what;
if(_loc1_.sound.getBytesTotal() == _loc1_.sound.getBytesLoaded())
{
_loc1_.sound.stop();
_loc1_.sound.start();
FeatureUnit9.removeInterval(_loc1_.intervalID);
}
}
_global.FeatureUnit9 = {};
FeatureUnit9.utils = {};
FeatureUnit9.utils.over = function(clip)
{
if(clip.hitTest(_level0._xmouse,_level0._ymouse,false))
{
return true;
}
return false;
};
FeatureUnit9.utils.lingoRoll = function()
{
if(FeatureUnit9.runtime)
{
getUrl("lingo: cursor 280", "");
}
};
FeatureUnit9.utils.lingoRollOut = function()
{
if(FeatureUnit9.runtime)
{
getUrl("lingo: cursor -1", "");
}
};
FeatureUnit9.utils.getOsInfo = function()
{
var _loc1_ = {};
_loc1_.maxSounds = 6;
switch(system.capabilities.os)
{
case "Windows XP":
break;
case "Windows 2000":
break;
case "Windows NT":
break;
case "Windows 98/ME":
break;
case "Windows 95":
break;
case "MacOS":
}
return _loc1_;
};
_global.lingo = function(str)
{
getURL("lingo:" + str,"");
};
fullscreenOpen = function()
{
lingo("FeatureUnit9FullscreenOpen()");
};
fullscreenClose = function()
{
lingo("FeatureUnit9FullscreenClose()");
};
exampleLink = function()
{
this.unloadMovie();
lingo("FeatureUnit9Link(2,\"#0\")");
};
webPageOpen = function(strURL)
{
lingo("Flsh_webPageOpen(\"" + strURL + "\")");
};
emailOpen = function(strEmailAddress, strSubject)
{
lingo("Flsh_openEmail(\"" + strEmailAddress + "\",\"" + strSubject + "\")");
};
close = function()
{
};
FeatureUnit9.utils.cursor = function(what)
{
if(FeatureUnit9.runtime)
{
lingo("cursor " + String(what));
}
};
FeatureUnit9.objtrace = function(what)
{
var _loc2_ = what;
var _loc1_ = undefined;
for(_loc1_ in _loc2_)
{
}
};
if(_global.Tardis == undefined)
{
_global.Tardis = {};
Tardis.Settings = {};
if(_global.Feature == undefined)
{
Tardis.Settings.FeatureUnit9_ASSETS = "";
}
else
{
Tardis.Settings.FeatureUnit9_ASSETS = "movies/";
}
}
FeatureUnit9.timeLine = this;
FeatureUnit9.path = Tardis.Settings.FeatureUnit9_ASSETS;
FeatureUnit9.intervals = {};
FeatureUnit9.runtime = false;
FeatureUnit9.stageWidth = 770;
FeatureUnit9.stageHeight = 395;
FeatureUnit9.structure = [1,3];
FeatureUnit9.ambientSounds = [false,true];
FeatureUnit9.introSounds = [[false],[false,false,false]];
FeatureUnit9.ambientFirst = [[false],[false,false]];
FeatureUnit9.extraFrames = [[0],[0,0,0]];
FeatureUnit9.osInfo = FeatureUnit9.utils.getOsInfo();
FeatureUnit9.objTrace(FeatureUnit9.osInfo);
FeatureUnit9.addInterval = function(what)
{
FeatureUnit9.intervals["ID_" + what.toString()] = what;
};
FeatureUnit9.removeInterval = function(what)
{
var _loc1_ = what;
delete FeatureUnit9.intervals["ID_" + _loc1_.toString()];
clearInterval(_loc1_);
};
this.onUnload = function()
{
var _loc1_ = undefined;
for(_loc1_ in FeatureUnit9.intervals)
{
clearInterval(FeatureUnit9.intervals[_loc1_]);
}
FeatureUnit9.mediaManager.shutDown();
};
_global.FeatureUnit9.mediaManager = {};
FeatureUnit9.mediaManager.ini = function()
{
this.trace("starting ini");
FeatureUnit9.mediaManager.mediaPlayed = {};
FeatureUnit9.mediaManager._debugLevel = 0;
FeatureUnit9.mediaManager.introSoundPlayList = [];
FeatureUnit9.mediaManager.ambientSoundPlayList = [];
FeatureUnit9.mediaManager.effectSoundPlayList = [];
FeatureUnit9.mediaManager.currentIntroSound = null;
FeatureUnit9.mediaManager.currentAmbientSound = null;
FeatureUnit9.mediaManager.effectSound = null;
FeatureUnit9.mediaManager.introSounds = FeatureUnit9.introSounds;
FeatureUnit9.mediaManager.ambientSounds = FeatureUnit9.ambientSounds;
FeatureUnit9.mediaManager.soundFadeSpeed = 5;
FeatureUnit9.mediaManager.currentMedia = null;
FeatureUnit9.mediaManager.currentMediaInFrame = {};
FeatureUnit9.mediaManager.currentChapter = -1;
FeatureUnit9.mediaManager.depthCounter = 1;
};
FeatureUnit9.mediaManager.setMonitorInterval = function()
{
this.trace("set monitor interval");
FeatureUnit9.mediaManager.monitorID = setInterval(FeatureUnit9.mediaManager,"monitor",1000);
FeatureUnit9.addInterval(FeatureUnit9.mediaManager.monitorID);
};
FeatureUnit9.mediaManager.launchMedia = function(clipFileName, selfStartingFlag)
{
with(this)
{
iniSoundsVolume = clipFileName.fadeOtherSoundTo;
tClip = currentMediaInFrame[clipFileName];
var okToOpenFlag = true;
if(currentMedia.active)
{
if(currentMedia.mode == "in")
{
currentMedia.close();
}
else
{
okToOpenFlag = false;
}
}
else if(currentMedia.mode == "in")
{
currentMedia.close();
okToOpenFlag = false;
}
if(currentMedia == tClip)
{
if(currentMedia.mode == "terminating")
{
okToOpenFlag = false;
}
}
if(okToOpenFlag)
{
FeatureUnit9.utils.cursor(4);
currentMedia = tClip;
tClip.show();
if(tClip.mediaType == "VIDEO" || tClip.mediaType == "SOUND")
{
if(currentAmbientSound == undefined)
{
currentAmbientSound = new Sound();
}
if(currentIntroSound == undefined)
{
currentIntroSound = new Sound();
}
FeatureUnit9.currentSceneName = "section" + File.currentSection + "_mc";
_global.unit9MediaOpen = true;
resetVolume = _global.unit9endVolume;
_level0.backgroundSound.startSoundFade(0,1000);
FeatureUnit9.removeInterval(currentIntroSound.intervalID);
currentIntroSound.intervalID = setInterval(currentIntroSound,"fadeOut",50,tClip.fadeOtherSoundTo);
currentIntroSound.mode = "fadedOut";
FeatureUnit9.addInterval(currentIntroSound.intervalID);
FeatureUnit9.removeInterval(currentAmbientSound.intervalID);
currentAmbientSound.intervalID = setInterval(currentAmbientSound,"fadeOut",50,tClip.fadeOtherSoundTo);
currentAmbientSound.mode = "fadedOut";
FeatureUnit9.addInterval(currentAmbientSound.intervalID);
}
}
}
this.trace("ended launchMedia");
};
FeatureUnit9.mediaManager.monitor = function()
{
with(this)
{
if(!tClip.active)
{
this.trace(5,"monitor: no currentMedia.active");
this.trace(8,"monitor: currentIntroSound.mode: " + currentIntroSound.mode);
this.trace(8,"monitor: currentAmbientSound.mode: " + currentAmbientSound.mode);
if(currentIntroSound.mode == "fadedOut")
{
fadeBackIntro();
}
if(currentAmbientSound.mode == "fadedOut")
{
fadeBackAmbient();
}
}
}
this.trace(4,"monitor: ending");
};
FeatureUnit9.mediaManager.fadeBackIntro = function()
{
with(this)
{
FeatureUnit9.removeInterval(currentIntroSound.intervalID);
currentIntroSound.intervalID = setInterval(currentIntroSound,"fadeIn",50,100);
FeatureUnit9.addInterval(currentIntroSound.intervalID);
currentIntroSound.mode = "fadedIn";
}
};
FeatureUnit9.mediaManager.fadeBackAmbient = function()
{
FeatureUnit9.currentSceneName = "section" + File.currentSection + "_mc";
targetVolumeFadeIn = _global.unit9endVolume;
if(targetVolumeFadeIn < 0)
{
targetVolumeFadeIn = 100;
}
_global.unit9MediaOpen = false;
_level0.backgroundSound.startSoundFade(100,1000);
with(this)
{
FeatureUnit9.removeInterval(currentAmbientSound.intervalID);
currentAmbientSound.intervalID = setInterval(currentAmbientSound,"fadeIn",50,100);
FeatureUnit9.addInterval(currentAmbientSound.intervalID);
currentAmbientSound.mode = "fadedIn";
}
};
FeatureUnit9.mediaManager.shutDown = function()
{
this.trace(1,"starting shutdown");
with(this)
{
this.removeSounds(introSoundPlayList);
this.removeSounds(ambientSoundPlayList);
this.currentMedia.mc_media.stop();
currentMediaInFrame.shutDown();
}
this.trace(1,"ending shutdown");
};
FeatureUnit9.mediaManager.removeSounds = function(soundList)
{
var _loc2_ = soundList;
var _loc1_ = 0;
while(_loc1_ < _loc2_.length)
{
_loc2_[0].stop();
_loc2_.shift();
_loc1_ = _loc1_ + 1;
}
};
FeatureUnit9.mediaManager.pruneSoundList = function(soundList, arrayLength)
{
var _loc1_ = soundList;
var _loc2_ = arrayLength;
while(_loc1_.length > _loc2_)
{
_loc1_[0].kill();
_loc1_.shift();
}
};
FeatureUnit9.mediaManager.fadeOutFirst = function(tSound)
{
var _loc1_ = tSound;
FeatureUnit9.removeInterval(_loc1_.intervalID);
_loc1_.intervalID = setInterval(_loc1_,"fadeOut",50,-1);
FeatureUnit9.addInterval(_loc1_.intervalID);
};
FeatureUnit9.mediaManager.launchIntroSound = function(chapterIndex, sectionIndex)
{
FeatureUnit9.mediaManager.iniSoundsVolume = 100;
this.assert(!(chapterIndex instanceof Number),"launchIntroSound - chapterIndex is a number? [" + chapterIndex + "]");
with(this)
{
pruneSoundList(introSoundPlayList,1);
fadeOutFirst(currentIntroSound);
if(FeatureUnit9.introSounds[chapterIndex][sectionIndex - 1])
{
var launchFlag = true;
if(FeatureUnit9.osInfo.maxSounds < 4)
{
if(FeatureUnit9.ambientFirst[chapterIndex][sectionIndex - 1])
{
launchFlag = false;
}
}
if(launchFlag)
{
this.trace(2,"launchIntroSound - this chapter has an intro");
this.trace(2,"sectionIndex=" + sectionIndex);
currentIntroSound = makeSound(introSoundPlayList,chapterIndex,false,"intro_",sectionIndex);
this.trace(2,"currentIntroSound.name is now: " + currentIntroSound.name);
introSoundPlayList.push(currentIntroSound);
}
}
}
};
FeatureUnit9.mediaManager.launchEffectSound = function(tFileName, looping)
{
if(FeatureUnit9.osInfo.maxSounds > 5)
{
with(this)
{
pruneSoundList(effectSoundPlayList,5);
var tSound = makeSound(effectSoundPlayList,null,false,tFileName,null,true);
effectSoundPlayList.push(tSound);
}
}
return tSound;
};
FeatureUnit9.mediaManager.launchAmbientSound = function(chapterIndex, sectionIndex)
{
this.trace(1,"starting launchAmbientSound on chapterIndex = " + chapterIndex);
this.assert(!(chapterIndex instanceof Number),"launchAmbientSound - chapterIndex is a number? [" + chapterIndex + "]");
with(this)
{
var launchFlag = true;
if(FeatureUnit9.osInfo.maxSounds < 4)
{
if(!FeatureUnit9.ambientFirst[chapterIndex][sectionIndex - 1])
{
launchFlag = false;
pruneSoundList(ambientSoundPlayList,1);
}
}
if(ambientSounds[chapterIndex])
{
if(currentAmbientSound.chapterIndex != chapterIndex)
{
FeatureUnit9.mediaManager.fadeOutFirst(currentAmbientSound);
if(launchFlag)
{
currentAmbientSound = makeSound(ambientSound,chapterIndex,true,"ambient_",null);
currentAmbientSound.sound.setVolume(0);
ambientSoundPlayList.push(currentAmbientSound);
}
}
else if(launchFlag)
{
if(currentAmbientSound.volumeTarget == -1)
{
currentAmbientSound = makeSound(ambientSound,chapterIndex,true,"ambient_",null);
ambientSoundPlayList.push(currentAmbientSound);
}
}
else
{
FeatureUnit9.mediaManager.fadeOutFirst(currentAmbientSound);
}
}
else
{
FeatureUnit9.mediaManager.fadeOutFirst(currentAmbientSound);
}
}
};
FeatureUnit9.mediaManager.isAlreadyPlaying = function(soundList, chapterIndex, sectionIndex)
{
this.trace(1,"starting isAlreadyPlaying on soundList [" + soundList + "] and chapterIndex = " + chapterIndex);
with(this)
{
if(!soundList.length)
{
return false;
}
if(sectionIndex != undefined)
{
return soundList[soundList.length - 1].chapterIndex == chapterIndex && soundList[soundList.length - 1].sectionIndex == sectionIndex;
}
return soundList[soundList.length - 1].chapterIndex == chapterIndex;
}
};
FeatureUnit9.mediaManager.makeSound = function(tArray, chapterIndex, loopingFlag, tSoundFileName, sectionIndex, event)
{
if(chapterIndex != null)
{
tSoundFileName += chapterIndex;
}
if(sectionIndex != null)
{
tSoundFileName += "_" + sectionIndex;
}
this.trace(2,"starting makeSound with : [" + tArray + "], " + chapterIndex + ", " + loopingFlag + ", " + tSoundFileName);
var mm = this;
with(this)
{
createEmptyMovieClip("sound_" + String(depthCounter),depthCounter % 20);
var tSound = eval("sound_" + String(depthCounter));
tSound.ID = "sound_" + String(depthCounter);
depthCounter++;
tSound.sound = new Sound(tSound);
tSound.chapterIndex = chapterIndex;
tSound.name = tSoundFileName;
tSound.sound.loadSound(Tardis.Settings.FEATURE_ASSETS + "media/mp3/" + tSound.name + ".mp3",!event);
tSound.array = tArray;
tSound.fadeOut = function(volumeTarget)
{
var tVolume = this.sound.getVolume() - FeatureUnit9.mediaManager.soundFadeSpeed;
if(tVolume <= volumeTarget)
{
FeatureUnit9.removeInterval(this.intervalID);
if(tVolume <= 0)
{
if(volumeTarget == -1)
{
this.sound.stop();
this.array.shift();
var tClip = eval(this.ID);
tClip.removeMovieClip();
delete this;
this.volumeTarget = volumeTarget;
}
else
{
this.sound.setVolume(0);
}
}
else
{
mm.trace(1,"makeSound fadeOut handler - " + this.name + " - setting sound to=" + volumeTarget);
this.sound.setVolume(volumeTarget);
}
}
else
{
this.sound.setVolume(tVolume);
mm.trace(1,"makeSound fadeOut handler - " + this.name + " - fadingOut" + tVolume);
}
};
tSound.fadeIn = function(volumeTarget)
{
var _loc2_ = this;
var _loc1_ = _loc2_.sound.getVolume() + FeatureUnit9.mediaManager.soundFadeSpeed;
if(_loc1_ >= volumeTarget)
{
FeatureUnit9.removeInterval(_loc2_.intervalID);
}
else
{
mm.trace(1,"makeSound - fadeIn handler - volume:" + _loc1_);
_loc2_.sound.setVolume(_loc1_);
}
};
tSound.kill = function()
{
mm.trace(1,"makeSound - kill handler");
var tClip = eval(this.ID);
tClip.removeMovieClip();
FeatureUnit9.removeInterval(this.intervalID);
this.sound.stop();
delete this();
this = null;
};
this.trace(3,"makeSound: ambientFlag= " + ambientFlag);
if(loopingFlag)
{
this.trace(3,"makeSound - this is looping");
tSound.sound.onSoundComplete = function()
{
this.start();
};
}
else
{
tSound.sound.onSoundComplete = function()
{
tSound.kill();
};
}
tSound.sound.onLoad = function()
{
this.start();
};
tSound.intervalID = setInterval(monitorLoad,40,tSound);
tSound.watch(intervalID);
FeatureUnit9.addInterval(tSound.intervalID);
}
return tSound;
};
FeatureUnit9.mediaManager.register = function(what)
{
var _loc1_ = what;
this.trace("register: " + _loc1_ + " what.filename = " + _loc1_.fileName);
this.currentMediaInFrame[_loc1_.fileName] = _loc1_;
};
FeatureUnit9.mediaManager.unRegister = function(what)
{
var _loc1_ = what;
this.trace("unregister: " + _loc1_ + " what.filename = " + _loc1_.fileName);
delete this.currentMediaInFrame[_loc1_.fileName];
};
FeatureUnit9.mediaManager.trace = function()
{
var _loc2_ = undefined;
var message;
if(arguments.length > 1)
{
_loc2_ = arguments[0];
message = arguments[1];
}
else
{
_loc2_ = 1;
message = arguments[0];
}
if(_loc2_ <= this._debugLevel)
{
var _loc3_ = "";
var _loc1_ = 2;
while(_loc1_ <= _loc2_)
{
_loc3_ += ">>";
_loc1_ = _loc1_ + 1;
}
}
};
FeatureUnit9.mediaManager.assert = function(result, mesage)
{
if(!result)
{
this.trace("!!!!!!!!!!!!!!!!!!!!!!!! AARGH !!!!!!!!!!!!!!!!!! - asertion failed: " + message);
stopAllSounds();
stop();
}
else
{
this.trace(5,"assertion succeeded: " + mesage);
}
};
FeatureUnit9.mediaManager.ini();
FeatureUnit9.mediaManager.setMonitorInterval();
FeatureUnit9.playSound = function(what, looping)
{
tSound = new Sound();
tSound.loadSound(Tardis.Settings.FeatureUnit9_ASSETS + "media/mp3/" + what + ".mp3");
tSound.start();
if(looping)
{
tSound.onSoundComplete = function()
{
this.start();
};
}
};
if(!FeatureUnit9.runtime)
{
if(FeatureUnit9.debugger == undefined)
{
FeatureUnit9.debugger = {};
}
FeatureUnit9.debugger.active = true;
FeatureUnit9.debugger.doCheckFrames = true;
FeatureUnit9.debugger.checkFrames = function()
{
if(FeatureUnit9.debugger.framesChecked == undefined)
{
FeatureUnit9.debugger.framesChecked = true;
var report = "";
i = 0;
while(i < FeatureUnit9.navManager.labelList.length)
{
var _loc2_ = _currentframe;
gotoAndPlay(FeatureUnit9.navManager.labelList[i]);
var _loc1_ = _currentframe;
if(_loc2_ == _loc1_)
{
}
i++;
}
}
};
FeatureUnit9.debugger.load = function()
{
var _loc1_ = this;
createEmptyMovieClip("debugger",10000);
debugger._x = 800;
debugger.loadMovie("debugger.swf");
_loc1_.dblmID = setInterval(_loc1_,debugLoadMonitor,50);
FeatureUnit9.addInterval(_loc1_.dblmID);
};
FeatureUnit9.debugger.debugLoadMonitor = function()
{
if(debugger.getBytesLoaded() == debugger.getBytesTotal())
{
debugger.onPress = function()
{
};
FeatureUnit9.removeInterval(dblmID);
}
};
if(FeatureUnit9.debugger.active)
{
FeatureUnit9.debugger.load();
}
if(FeatureUnit9.debugger.doCheckFrames)
{
FeatureUnit9.debugger.checkFrames();
}
FeatureUnit9.debugger.frameNum = 1;
FeatureUnit9.debugger.getCurrentFrame = function()
{
if(FeatureUnit9.debugger.frameNum != _currentframe)
{
FeatureUnit9.debugger.frameNum = _currentframe;
}
};
setInterval(FeatureUnit9.debugger,"getCurrentFrame",20);
}
_global.unit9OpenSpoke = function(fileName, mediaTitle, inTransition, outTransition, duration, playerType, spokeNumber)
{
if(File.currentSection != undefined)
{
spokeTargetPrefix_mc = "_level0.section" + File.currentSection + "_mc.spokePlayer";
}
else
{
spokeTargetPrefix_mc = "_root.spokePlayer";
}
spokeIndex = 1;
while(spokeIndex < 20)
{
spokeTarget_mc = spokeTargetPrefix_mc + spokeIndex + "_mc";
target_mc = eval(spokeTarget_mc);
target_mc.gotoAndPlay("closeFrame");
spokeIndex++;
}
if(File.currentSection != undefined)
{
spokeTarget_mc = "_level0.section" + File.currentSection + "_mc.spokePlayer" + spokeNumber + "_mc";
}
else
{
spokeTarget_mc = "_root.spokePlayer" + spokeNumber + "_mc";
}
target_mc = eval(spokeTarget_mc);
target_mc.fileName = fileName;
target_mc.mediaTitle = mediaTitle;
target_mc.inTransition = inTransition;
target_mc.outTransition = outTransition;
target_mc.duration = duration;
target_mc.playerType = playerType;
switch(playerType)
{
case 2:
target_mc.MCYposition = 40;
break;
case 4:
target_mc.MCYposition = 0;
break;
default:
target_mc.MCYposition = 0;
}
target_mc.gotoAndPlay(2);
};
_global.unit9spokeSkip = 500;
if(!_global.sceneInit)
{
_global.sceneInit = function()
{
};
}